package com.service.totalauth;


import com.service.totalauth.annotation.EnableGcFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

/**
 * @ClassName: AiFinshingPortApplication
 * @Description: 启动类
 * @Author guochuang
 * @Date 2021/10/19
 * @Version 1.0
 */
@SpringBootApplication
@EnableEurekaClient
@EnableGcFeignClients
@EnableScheduling
@ServletComponentScan(value = "com.service.config.annotation")
@ComponentScan(basePackages = {"com.service"})
@MapperScan("com.service.totalauth.dao")
@EnableTransactionManagement    //开启事务管理
@EnableAsync(proxyTargetClass=true)    //配置代理为cglib代理，默认使用 的是jdk动态代理
public class TotalAuthApplication {
    public static void main(String[] args) {
        SpringApplication.run(TotalAuthApplication.class, args);
    }
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //单个文件最大   KB,MB
        factory.setMaxFileSize(DataSize.parse("100MB"));
        /// 设置总上传数据总大小
        factory.setMaxRequestSize(DataSize.parse("500MB"));
        return factory.createMultipartConfig();
    }
}
